<?php

class Medico extends DBAbstractModel {
    
    public $nombre;
    public $atendido_en;
    public $diagnostico;
    
    function save() {
        $this->query = '';
        $this->query = "INSERT INTO medicos (nombre,atendido_en,diagnostico) VALUES ";
        $this->query.="('$this->nombre','$this->atendido_en','$this->diagnostico');";
        echo "query insertar: " . $this->query . "</br>";
        $this->execute_single_query();
    }
     function delete($key) {

        $this->query = '';
        $this->query = "DELETE FROM medicos WHERE nombre='$key'";
        echo "query eliminar: " . $this->query . "</br>";
        $this->execute_single_query();
    }
    
    function update($key) {
        $this->query = '';
        $this->query = "UPDATE  medicos SET nombre='$this->nombre',";
        $this->query.=" atendido_en='$this->atendido_en', diagnostico='$this->diagnostico'";
            $this->query.= "where nombre = '$key'";    
        echo " <br /> query actualizar: " . $this->query . "</br>";
        $this->execute_single_query();
    }
    
        
    function get($key) {
        if ($key != ''):
            $this->query = "SELECT *FROM medicos WHERE nombre = '$key'";
            $this->get_results_from_query();
        endif;
    }
    function getAll() {
        $this->query = "SELECT *FROM medicos";
        $this->get_results_from_query();
    }
}
?>
